home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue38
/
Clinic
/
StpKey4U.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-07-07
|
2KB
|
97 lines
unit StpKey4U;
interface
uses
WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
DummyItems1: TMenuItem;
Colour1: TMenuItem;
Minimise1: TMenuItem;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Label4: TLabel;
F21: TMenuItem;
AltS1: TMenuItem;
procedure Colour1Click(Sender: TObject);
procedure Minimise1Click(Sender: TObject);
procedure AltS1Click(Sender: TObject);
procedure F21Click(Sender: TObject);
procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Colour1Click(Sender: TObject);
begin
Color := RGB(Random(256), Random(256), Random(256))
end;
procedure TForm1.Minimise1Click(Sender: TObject);
begin
Application.Minimize
end;
procedure TForm1.AltS1Click(Sender: TObject);
begin
Caption := 'Alt+S pressed at ' + TimeToStr(Time)
end;
procedure TForm1.F21Click(Sender: TObject);
begin
Caption := 'F2 pressed at ' + TimeToStr(Time)
end;
procedure TForm1.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
var
Shift: TShiftState;
begin
Shift := KeyDataToShiftState(Msg.KeyData);
if (Msg.CharCode = vk_F2) and (Shift = []) then
begin
Caption := 'F2 was pressed at ' + TimeToStr(Time);
Handled := True
end;
if (Msg.CharCode = vk_Escape) and (Shift = []) then
begin
Color := RGB(Random(256), Random(256), Random(256));
Handled := True
end;
if (UpCase(Chr(Msg.CharCode)) = 'S') and (Shift = [ssCtrl]) then
begin
Application.Minimize;
Handled := True
end;
if (UpCase(Chr(Msg.CharCode)) = 'S') and (Shift = [ssAlt]) then
begin
Caption := 'Alt+S was pressed at ' + TimeToStr(Time);
Handled := True
end
end;
initialization
Randomize
end.